{% extends "base.html" %}

{% block content %}
<script type="text/javascript" src="/static/js/ajax.js" ></script>
<script language=javascript>

function verify(form){
  if(form.maincontent.value==""){
	alert("Enter the maincontent please!");
	form.maincontent.focus();		
       return false;
	}
  if(form.address.value==""){
	alert("Enter the address please!");
	form.address.focus();		
       return false;
	}
	return true;
 }

</script>


	<form name='form1' id='form1' action="/save_wm/" method='post' onsubmit='return verify(this);'  enctype="multipart/form-data">
<table width='80%' class='grid' cellspacing='1' align='center'><tr><td colspan='10' class='title' align="center">Mail template</td></tr>
<tr><td class='even'>Program</td><td class='odd'><select name="p_id" id="p_id" style='color:#CC33FF'>
{% for p in pj %}
<option value="{{p.id}}" {% ifequal wm.program.id p.id %} selected="selected" {% endifequal %}>{{p.name}}</option>
{% endfor %}
</select></td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'><font color="red">*</font>title</td><td class='even'><input type="text" name="title" value='{{wm.title}}' style='width:600px'></td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'><font color="red">*</font>Using</td><td class='even'><input type="checkbox" name="autosendmail" value="1" {%if wm.autosendmail%}checked{%endif%}   />&nbsp;<font color='red'>This selection will only take effect </font></td></tr>
<tr><td class='even' colspan='2'>Dear (Customers'name),</td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'><font color="red">*</font>content</td>
<td class='even'><textarea name="maincontent" rows="10" cols="80">{{wm.maincontent}}</textarea></td></tr>
<tr valign='middle' align='left'><td class='odd' colspan='2'>Should you have any queries, please do not hesitate to contact me at (sales's tel) or email at (sales's email)</td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'><font color="red">*</font>thanks</td>
<td class='even'><textarea name="thanks" cols="80" rows="2" />{{wm.thanks}}</textarea></td></tr>
<tr valign='middle' align='left'><td class='odd' colspan='2'>Best regards,<br/>(sales's truename)</td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'><font color="red">*</font>address</td>
<td class='even'><textarea name="address" rows="10" cols="80">{{wm.address}}</textarea></td></tr>
<tr valign='middle' align='left'><td class='odd' colspan='2'>Email:(sales's email)</td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'><font color="red">*</font>site</td>
<td class='even'><input type="text" name="site" value='{{wm.site}}' style='width:400px'></td></tr>
<tr valign='middle' align='left'><td class='odd' width='15%'>file:</td>
<td class='even'><input type='file' name='mailfile' id="mailfile" value='' class='' />&nbsp;<span id="atmailfile">{%if wm.fileurl%}<a href="{{wm.fileurl}}">{{wm.fileurl}}</a>{%endif%}</span>&nbsp;&nbsp;  <input type="button" name="delfile" value=" Delete " onclick="delatmailfile({{wm.id}})" /></td></tr>

<tr valign='middle' align='left'><td class='odd' width='15%'></td>

<td class='even'>&nbsp;
<input type="hidden" name="wmid" value="{{wm.id}}" />
<input type='submit' class='button' name='submit'  id='submit' value=' Submit ' onclick="ccc(this.form,this)" /></td></tr>

</table>
</form>



{% endblock %}